/*
 * TreeNode.java  0.4.0 / Oct 25, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.tree;

import java.util.Iterator;

/**
 * Tree Node Interface.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public interface TreeNode {

  /**
   * Returns parent of the node.
   *
   * @return parent of the node
   */
  public TreeNode getParent();

  /**
   * Returns <tt>true</tt> if the node is leaf.
   *
   * @return <tt>true</tt> if the node is leaf
   */
  public boolean isLeaf();

  /**
   * Returns <tt>true</tt> if the node allows children.
   *
   * @return <tt>true</tt> if the node allows children
   */
  public boolean getAllowsChildren();

  /**
   * Returns the number of children.
   *
   * @return the number of children
   */
  public int getChildCount();

  /**
   * Returns child at the specified index.
   *
   * @param index the child index
   *
   * @return child at the specified index
   */
  public TreeNode getChildAt(int index);

  /**
   * Returns index of specified node or -1 if there is no such node.
   *
   * @param node the node
   *
   * @return index of specified node or -1 if there is no such node
   */
  public int getIndex(TreeNode node);

  /**
   * Returns iterator over the children of the node.
   *
   * @return iterator over the children of the node
   */
  public Iterator children();

}
